package com.example.demovote.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

/**
 * <p>
 * 投票系统-用户表-4
 * </p>
 *
 * @author ly
 * @since 2024-03-18
 */
@TableName("tp_user")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

      /**
     * 编号, 自增列
     */
        @TableId(value = "id", type = IdType.AUTO)
      private Integer id;

      /**
     * 用户名
     */
      @NotEmpty
      @Length(min=2,max=20,message = "用户名必须是2~20个字符")
      private String uname;

      /**
     * 密码
     */
      @NotEmpty
      @Length(min=6,max=18,message = "密码必须是6~18个字符")
      @Pattern(regexp = "[0-9a-zA-Z]{6,18}", message = "密码必须由数字字母构成")
      private String pwd;

    
    public Integer getId() {
        return id;
    }

      public void setId(Integer id) {
          this.id = id;
      }
    
    public String getUname() {
        return uname;
    }

      public void setUname(String uname) {
          this.uname = uname;
      }
    
    public String getPwd() {
        return pwd;
    }

      public void setPwd(String pwd) {
          this.pwd = pwd;
      }

    @Override
    public String toString() {
        return "User{" +
              "id=" + id +
                  ", uname=" + uname +
                  ", pwd=" + pwd +
              "}";
    }
}
